<?php
include('../common/_const.php');
include('../common/common.php');
include('../common/checksession.php');
checksession("../index.php");
include('../../inc/conn.php');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $sys_title['add_catalog'];?></title>
<link href="../images/css1/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function checkform(o){
if(o.cat_name.value==""){
 alert("请填写栏目标题!");
 o.cat_name.focus();
 return false;

}
if(o.cat_rank.value==""){
 alert("请填写排序");
 o.cat_rank.focus();
 return false;
}
if(isNaN(Number(o.cat_rank.value))){
 alert("排序请填写一个数字");
 o.cat_rank.select();
 return false;
}
}
function checktext(v,o){
var k=document.getElementById("ps"+o);
var text="不填写将显示默认值!";
if(v.value==""){
k.innerHTML=text;
}else{k.innerHTML="";}

}
</script>
</head>

<body>
<form action="../action/ac_catalog_add.php" method="post" onsubmit="return checkform(this)">
<table class="table" cellspacing="1" cellpadding="2" width="99%" align="center" 
border="0">
  <tbody>
    <tr>
      <th class="bg_tr" align="left" colspan="2" height="25">
      	&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $sys_title['add_catalog'];?>
      </th>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">栏目类型：</td>
      <td width="83%" class="td_bg">
	  <?php 
	   $db=db_connect();//数据库连接
	   $sql=select_sql("`id`,`channelname`",PRETABLE."channeltype","`id`='1'");
	   $rs=@$db->query($sql) or die("系统错误!");
	  ?>
    
       <?php $row = $rs->fetch_assoc()?>
	  <input type="text" class="cat_input" style="width:180px;" value="<?php echo $row['channelname']; ?>" disabled="disabled" />
	  <input type="hidden" name="cat_style" value="1" />
	  </td>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">上级栏目：</td>
      <td width="83%" class="td_bg">
      <?php
	  $sql=select_sql("`typename`,`id`",PRETABLE."arctype","1=1 order by sortrank asc");
	  $rs=@$db->query($sql) or die("系统错误!");
	  ?>
      <select name="parent_cat" class="cat_slect">
      	<option value="0" >顶级栏目</option>
       <?php while ($row = $rs->fetch_assoc()) {?>
        <option value="<?php echo $row['id']; ?>"><?php echo $row['typename']; ?></option>
        <?php }
		$rs->close();
		$db->close();
		?>
      </select>
      </td>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">栏目名称：</td>
      <td width="83%" class="td_bg"><input type="text" name="cat_name" class="cat_input" style="width:280px;" value="" /></td>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">排列顺序：<span class="TableRow2"></span></td>
      <td width="83%" class="td_bg"><input type="text" name="cat_rank" class="cat_input" style="width:80px;" value="20" /></td>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">SEO标题：<span class="TableRow2"></span></td>
      <td width="83%"class="td_bg">
      <input type="text" name="seo_title" class="cat_input" style="width:280px; float:left;" value=""  onblur="checktext(this,'1')"/>
      <div style="float:left; padding-top:8px; padding-left:12px; color:#F00" id="ps1"></div>
      </td>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">关键字：<span class="TableRow2"></span></td>
      <td class="td_bg" width="83%"><input name="cat_keywords" type="text" class="cat_input" style="width:280px; float:left;" value="" onblur="javascript:checktext(this,'2')"/>        <div style="float:left; padding-top:8px; padding-left:12px; color:#F00" id="ps2"></div></td>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">栏目描述：<span class="TableRow2"></span></td>
      <td class="td_bg" width="83%">
      <textarea name="cat_description" onblur="javascript:checktext(this,'3')" class="sys_area" style="margin-left:8px; float:left;"></textarea>
      <div style="float:left; padding-top:8px; padding-left:12px; color:#F00" id="ps3"></div> 
      </td>
    </tr>
    <tr>
      <td width="17%" height="23" align="right" class="td_bg">是否隐藏：<span class="TableRow2"></span></td>
      <td class="td_bg" width="83%">
      	<input type="radio" name="ishidden" value="1" /> 是
        <input type="radio" name="ishidden" value="0" checked="checked"/> 否
      </td>
    </tr>
     <tr>
      <td class="td_bg" width="17%" height="23"></td>
      <td class="td_bg" width="83%">
      <input type="submit" name="submit" value="提交" class="btn" />
      <input type="reset" value="重置" class="btn" />
      <input type="hidden" name="gurl" value="<?php echo GetCurUrl(); ?>" />
      </td>
    </tr>
  </tbody>
</table>
</form>
</body>
</html>